#!/bin/bash
work_path=/home/cjxx/go-media-pusher/check
log_path=${work_path}/logs/check_$(date '+%Y-%m-%d').log
pid=$(ps -ef | grep doss-pusher | grep -v grep | awk '{print $2}')
if [ ! -n "${pid}" ];
then
  echo "程序已经关闭了,正在重启... `date '+%Y-%m-%d %H:%M:%S'`" >> ${log_path}
  cd /home/cjxx/go-media-pusher/dist
  nohup ./doss-pusher >/dev/null 2>&1 &
else
  echo "程序运行正常`date '+%Y-%m-%d %H:%M:%S'`" >> ${log_path}
fi
